{extend name='common/content' /}
{block name="content"}
<style>
    /* 标签添加 搜索建议置顶显示 */
    .ui-widget-content {
        z-index: 29891017!important;
    }
</style>
<link rel="stylesheet" href="__PUBLIC__/static/plugs/tag/jquery.tag-editor.css?ver={:date('ymd')}"/>
{block name="content"}

<form name="article" class="layui-form layui-box" style='padding:25px 30px 20px 0' action="__SELF__" data-auto="true" method="post">
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

                <div class="layui-form-item">
                    <label class="layui-form-label">文章分类</label>
                    <div class="layui-input-block">
                        <select name='category' class='layui-select full-width'>
                            <option value="">请选择分类</option>
                            {foreach $menus as $menu}
                            {eq name='menu.id' value='$vo.category|default=0'}
                            <option selected  value='{$menu.id}'>{$menu.spl}{$menu.title}</option>
                            {else/}
                            <option  value='{$menu.id}'>{$menu.spl}{$menu.title}</option>
                            {/eq}
                            {/foreach}
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">文章标题</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" value='{$vo.title|default=""}' required="required"  title="请输入文章标题" placeholder="请输入文章标题" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">文章概述</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入文章概述" title="请输入文章概述" class="layui-textarea" name="description">{$vo.description|default=""}</textarea>
                    </div>
                </div>

                <!--<div class="layui-form-item">
                    <label class="layui-form-label">是否审核</label>
                    <div class="layui-input-block">
                        <input name="is_check" value="0" title="是" {eq name='0' value='$vo.is_check|default=0'}checked=""{/eq} type="radio">
                        <input name="is_check" value="1" title="否" {eq name='1' value='$vo.is_check|default=1'}checked=""{/eq} type="radio">
                    </div>
                </div>-->

                <div class="layui-form-item">
                    <label class="layui-form-label">封面图片</label>
                    <div class='layui-input-block'>

                        <!-- todo 默认图片设置 -->
                        <img data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{$vo.image_id|default='static/admin/theme/default/img/image.png'}"/>
                        <input type="hidden" name="image_id" onchange="$(this).prev('img').attr('src', this.value)" value="{$vo.image_id|default=''}" class="layui-input">
                        <a class="btn btn-link" data-file="one" data-type="ico,png,jpg" data-field="image_id">上传图片</a>
                        <p>建议上传商品图片的尺寸为xx px。</p>
                    </div>
                </div>




                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">文章内容</label>
                    <div class="layui-input-block">
                        <textarea name='content'>{$vo.content|default=''}</textarea>
                    </div>
                </div>

            </div>

        </div>
    </div>

    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        <input type="hidden" name="create_time" value="{:date('Y-m-d')}">
        <input type="hidden" name="create_by" value="{$user.create_by}">
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
        <button class="layui-btn" lay-submit="" lay-filter="submit">保存数据</button>
        <button type='button' data-open='{:url("$classuri/index")}' class="layui-btn layui-btn-danger">返回列表</button>
    </div>

</form>

<script>window.form.render();</script>

<script>
    layui.use(['form', 'laydate', 'element'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,element = layui.element; //选项卡 依赖element 模块
    });
</script>

{/block}
{block name='script'}
<script>
    $(function () {

        require(['ueditor'], function () {


            /*! 实例富文本编辑器  */
            var editor, $item;
            /*! 默认编辑第一篇图文 */
            editor = window.createEditor('[name="content"]', 'basic');

            /*! 编辑器初始化成功 */
            editor.ready(function () {
                var $form = $('form[name="article"]'), $body = $('body');
                $form.validate();
            });
        });
    });
</script>
{/block}

